package com.dingshi.security.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.ProgressBar;

import com.dingshi.security.R;

public class BatteryView extends LinearLayout {

	private LayoutInflater mInflater;
	private static ProgressBar pb;
	private LinearLayout mBarView;

	public BatteryView(Context context) {
		super(context);
		mInflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mBarView = (LinearLayout) mInflater.inflate(R.layout.batterylayout,
				null);
		addView(mBarView);
		pb = (ProgressBar) mBarView.findViewById(R.id.battery_number);
	}

	public BatteryView(Context context, AttributeSet attrs) {
		super(context, attrs);
		mInflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		mBarView = (LinearLayout) mInflater.inflate(R.layout.batterylayout,
				null);
		addView(mBarView);
		pb = (ProgressBar) mBarView.findViewById(R.id.battery_number);

	}

	public static void setBaateryValue(int value) {
		pb.setProgress(100 - value);
	}

}
